﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Account_Login : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        RegisterHyperLink.NavigateUrl = "Register.aspx?ReturnUrl=" + HttpUtility.UrlEncode(Request.QueryString["ReturnUrl"]);
        ImageButton logoutImageButton = (ImageButton)Master.FindControl("ibtnLogout");
        if (logoutImageButton != null)
            logoutImageButton.Visible = false;
    }
    protected void LoginButton_Click(object sender, EventArgs e)
    {
        try
        {
            bool bLogin = UserControl.Login(UserName.Text, Password.Text);
            if (bLogin)
            {
                Session["User"] = UserName.Text;
                Response.Redirect("../Default.aspx");
            }
        }
        catch (Exception ex)
        {
            Response.Write(ex.Message);
        }
    }
}
